package jackaroo.web.controller;

import jackaroo.pojo.Role;
import jackaroo.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author JackarooZhang
 * @date 2018/6/18 11:15
 */
@Controller
@RequestMapping("/test")
public class TestController {

    @Autowired
    private IRoleService iRoleService;

    @RequestMapping("/index")
    @ResponseBody
    public Role index() {

        Role role = new Role();
        role.setId(100L);
        role.setRoleName("张家乐");
        role.setNote("hello");
        return role;
    }

    @RequestMapping("/converter")
    @ResponseBody
    public Role convertRole(Role role) {

        return role;
    }

    @RequestMapping("/getRole")
    @ResponseBody
    public Role getRole(Long id) {
        Role role = new Role();
        role.setId(id);
        role.setRoleName("JackarooZhang");
        return iRoleService.getRoleById(role);
    }



}
